import utils
import torch.nn as nn
from tensorboardX import SummaryWriter

utils.path_check("./summary")

tensorboardX_writer = SummaryWriter("./summary")

def record_whole_model(model: nn.Module,loss,acc):
    for i, (name, param) in enumerate(model.named_parameters()):
        if 'bn' not in name:
            tensorboardX_writer.add_histogram(name, param, 0)
            tensorboardX_writer.add_scalar('loss', loss, i)
            tensorboardX_writer.add_scalar('acc', acc, i)
